CreateUnicodeToTextRunInfo
Creates and returns a Unicode converter object containing the information required for converting a Unicode text string to strings in one or more non-Unicode encodings.
pascal OSStatus CreateUnicodeToTextRunInfo ( ItemCount iNumberOfMappings, const UnicodeMapping iUnicodeMappings[], UnicodeToTextRunInfo *oUnicodeToTextInfo);
iNumberOfMappings
- The number of mappings specified by your application for converting from Unicode to any other encoding types, including other forms of Unicode. If you pass 0 for this parameter, the converter will use all of the scripts installed in the system. The primary script is the one with highest priority;
ScriptOrder
('itlm'
resource) determines the priority of the rest. If you set the high-order bit for this parameter, the Unicode converter assumes that theiEncodings
parameter contains a single element specifying the preferred encoding. This feature is supported for versions 1.2 or later of the converter.iUnicodeMappings
- A pointer to an array of structures of type
UnicodeMapping
(page 118). Your application provides this structure to identify the mappings to be used for the conversion. The order in which you specify the mappings determines the priority of the destination encodings. For this function, the Unicode mapping structure can specify a Unicode format ofkUnicode16BitFormat
orkUnicodeUTF8Format
. Note that the versions of the Unicode Converter prior to the Text Encoding Conversion Manager 1.2.1 do not supportkUnicodeUTF8Format
. Also, note that theunicodeEncoding
field should be the same for all of the entries iniUnicodeMappings
. If you passNULL
for theiUnicodeMappings
parameter, the converter uses all of the scripts installed in the system, assuming the default version of Unicode with 16-bit format. The primary script is the one with the highest priority andScriptOrder
('itlm'
resource) determines the priority of the rest. This is supported beginning with version 1.2 of the Text Encoding Conversion Manager.oUnicodeToTextInfo
- A pointer to a Unicode converter object for converting Unicode text strings to strings in one or more non-Unicode encodings. On output, a Unicode converter object that holds the mapping table information you supply as the
iUnicodeMappings
parameter and the state information related to the conversion.- function result
- A result code. In addition to various resource and memory errors, the function can return the following result codes:
kTextUnsupportedEncodingErr
One of the encodings specified by the Unicode mapping structure you supply is not currently supported.kTECMissingTableErr
A resource associated with one of the encodings is missing.kTECTableChecksumErr
A resource has an invalid checksum, indicating that it has become corrupted.- If an error is returned, the Unicode converter object is invalid. See "Text Encoding Conversion Manager Result Codes" (page 42) in the chapter "Basic Text Types Reference" for other possible result code values.
DISCUSSION
You pass a Unicode converter object returned from the functionCreateUnicodeToTextRunInfo to the function
ConvertFromUnicodeToTextRun
(page 150) orConvertFromUnicodeToScriptCodeRun
(page 155) to identify the information to be used for the conversion. These two functions modify the contents of the Unicode converter object.SEE ALSO
The functionCreateUnicodeToTextInfoByEncoding
(page 136)The function
CreateUnicodeToTextRunInfoByScriptCode
(page 149)